package dw.order

import dw.object.ExtensibleObject
import dw.value.EnumValue
import dw.value.Money

/**
 * Represents an order shipment.
 */
class Shipment extends ExtensibleObject {

	final static int 		SHIPPING_STATUS_NOTSHIPPED = 0,
							SHIPPING_STATUS_SHIPPED    = 1
							
	Money					adjustedMerchandizeTotalGrossPrice,
							adjustedMerchandizeTotalNetPrice,
							adjustedMerchandizeTotalPrice,
							adjustedMerchandizeTotalTax,
							adjustedShippingTotalGrossPrice,
							adjustedShippingTotalNetPrice,
							adjustedShippingTotalPrice,
							adjustedShippingTotalTax,
							merchandizeTotalGrossPrice,
							merchandizeTotalNetPrice,
							merchandizeTotalPrice,
							merchandizeTotalTax,
							proratedMerchandizeTotalPrice,
							shippingTotalGrossPrice,
							shippingTotalNetPrice,
							shippingTotalPrice,
							shippingTotalTax,
							totalGrossPrice,
							totalNetPrice,
							totalTax
							
	Collection				allLineItems,
							giftCertificateLineItems,
							productLineItems,
							shippingLineItems,
							shippingPriceAdjustments
	
	boolean					isDefault,
							gift
							
	String					giftMessage,
							ID,
							shipmentNo,
							shippingMethodID,
							trackingNumber
							
	OrderAddress			shippingAddress
	
	ShippingMethod			shippingMethod
							
	EnumValue				shippingStatus
	
	ShippingLineItem		standardShippingLineItem
							
	
	static transients = [ SHIPPING_STATUS_NOTSHIPPED, SHIPPING_STATUS_SHIPPED ]
	
    static constraints = {
		adjustedMerchandizeTotalGrossPrice(nullable: true)
		adjustedMerchandizeTotalNetPrice(nullable: true)
		adjustedMerchandizeTotalPrice(nullable: true)
		adjustedMerchandizeTotalTax(nullable: true)
		adjustedShippingTotalGrossPrice(nullable: true)
		adjustedShippingTotalNetPrice(nullable: true)
		adjustedShippingTotalPrice(nullable: true)
		adjustedShippingTotalTax(nullable: true)
		merchandizeTotalGrossPrice(nullable: true)
		merchandizeTotalNetPrice(nullable: true)
		merchandizeTotalPrice(nullable: true)
		merchandizeTotalTax(nullable: true)
		proratedMerchandizeTotalPrice(nullable: true)
		shippingTotalGrossPrice(nullable: true)
		shippingTotalNetPrice(nullable: true)
		shippingTotalPrice(nullable: true)
		shippingTotalTax(nullable: true)
		totalGrossPrice(nullable: true)
		totalNetPrice(nullable: true)
		totalTax(nullable: true)
		
		allLineItems(nullable: true)
		giftCertificateLineItems(nullable: true)
		productLineItems(nullable: true)
		shippingLineItems(nullable: true)
		shippingPriceAdjustments(nullable: true)
		
		isDefault(nullable: true)
		gift(nullable: true)
		
		giftMessage(nullable: true)
		ID(nullable: false)
		shipmentNo(nullable: true)
		shippingMethodID(nullable: true)
		trackingNumber(nullable: true)
		
		shippingAddress(nullable: true)
		
		shippingMethod(nullable: true)
		
		shippingStatus(nullable: true)
		
		standardShippingLineItem(nullable: true)
    }
	
	static mapping = {
		id generator: "uuid", name: "UUID", column: "UUID", unique:"true"
	}
}
